home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mastering Microsoft Visual Basic 5
/
Mastering Microsoft Visual Basic 5.ISO
/
sampapps
/
event notification
/
notifier.cls
< prev
next >
Wrap
Text File
|
1997-01-15
|
1KB
|
54 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Notifier"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
' This example uses the timer control to generate timer events
' to simulate an asynchronous task in the Notifier component. Also
' the timer control is easy to use, it does have the significant
' overhead of requiring a form to be created to act as the control's
' parent. If your component does not require a form for other purposes,
' it would probably be more efficient to use the Window's timers
' directly rather than the timer control.
Event Alarm()
Public Property Get Interval() As Long
Interval = frmMain.TheTimer.Interval
End Property
Public Property Let Interval(ByVal vNewValue As Long)
frmMain.TheTimer.Interval = vNewValue
End Property
Public Property Get Enabled() As Boolean
Enabled = frmMain.TheTimer.Enabled
End Property
Public Property Let Enabled(ByVal vNewValue As Boolean)
frmMain.TheTimer.Enabled = vNewValue
End Property
Private Sub Class_Initialize()
' Initialize the global object variable
Set gNotifier = Me
End Sub
Private Sub Class_Terminate()
' IMPORTANT: set the object variable to Nothing so that its
' reference count can return to zero and the object can be
' destroyed.
Set gNotifier = Nothing
End Sub
Friend Sub Alarm()
RaiseEvent Alarm
End Sub